package C11_6_ExtractSubclass.refactorafter;

/**
 * @ClassName : JobItem
 * @Description : 提炼子类
 * @Author : wukj1
 * @Date: 2022/8/15
 **/
public class JobItem {
    /**重构后*/
    private int _unitPrice;
    private int _quantity;

    protected JobItem(int _unitPrice, int _quantity) {
        this._unitPrice = _unitPrice;
        this._quantity = _quantity;
    }

    public int getTotalPrice() {
        return getUnitPrice() * this._quantity;
    }

    public int getUnitPrice() {
        return this._unitPrice;
    }

    public static void main(String[] args) {
        JobItem jobItem = new JobItem(300, 3);
        System.out.println("jobItem-TotalPrice: " + jobItem.getTotalPrice());
        JobItem laborItem = new LaborItem(3, new Employee(250));
        System.out.println("laborItem-TotalPrice: " + laborItem.getTotalPrice());
    }
}
